﻿using System;
using System.Collections.Generic;
using System.Text;
using Common;

namespace ManagerMachine
{
    public partial class ServerMachineGroup
    {
        public void SendMessage_L_CreatTable_OK(int IDUser, int TableID, string ip, int port)
        {
            List<byte> tmp = new List<byte>();
            tmp.AddRange(BitConverter.GetBytes(IDUser));
            tmp.AddRange(BitConverter.GetBytes(TableID));
            string ipandport = ip + ":" + port.ToString();
            tmp.AddRange(UTF8Encoding.UTF8.GetBytes(ipandport));
            connectionLogin.SendMessage(MSG_GSM.L_CreateTable_OK, tmp.ToArray());
            
        }

        public void SendMessage_L_JoinTable_OK(int IDUser, int TableID, string ip, int port)
        {
            List<byte> tmp = new List<byte>();
            tmp.AddRange(BitConverter.GetBytes(IDUser));
            tmp.AddRange(BitConverter.GetBytes(TableID));
            string ipandport = ip + ":" + port.ToString();
            tmp.AddRange(UTF8Encoding.UTF8.GetBytes(ipandport));
            connectionLogin.SendMessage(MSG_GSM.L_JoinTable_OK, tmp.ToArray());

        }
        public void SendMessage_L_CreateRoom_OK(int UserID, int RoomID, string RoomName)
        {
            List<byte> tmp = new List<byte>();
            tmp.AddRange(BitConverter.GetBytes(UserID));
            tmp.AddRange(BitConverter.GetBytes(RoomID));
            tmp.AddRange(UTF8Encoding.UTF8.GetBytes(RoomName));
            connectionLogin.SendMessage(MSG_GSM.L_CreateRoom_OK, tmp.ToArray());
        }
        public void SendMessage_L_JoinRoom_OK(int UserIDJoin, int RoomID)
        {
            List<byte> tmp = new List<byte>();
            tmp.AddRange(BitConverter.GetBytes(UserIDJoin));
            tmp.AddRange(BitConverter.GetBytes(RoomID));
            connectionLogin.SendMessage(MSG_GSM.L_JoinRoom_OK, tmp.ToArray());
        }
    }
}
